#include <algorithm>
#include <boost/phoenix/phoenix.hpp>
#include <boost/version.hpp>
#include <cmath>
#include <functional>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

using namespace boost::phoenix::arg_names;

struct My_Class {
    std::string me;
    std::string get_me() { return me; }
};

int main()
{
    std::cout << "Boost version: " << BOOST_LIB_VERSION << std::endl;

    std::vector<int> numbers { 21, 5, 62, 42, 53 };

    std::partition(numbers.begin(), numbers.end(), arg1 <= 42);
    for (auto& item : numbers) {
        std::cout << item << " ";
    }
    std::cout << std::endl;

    auto res = std::accumulate(numbers.cbegin(), numbers.cend(), std::vector<int> {}, [](std::vector<int> vec, int data) { vec.emplace_back(data + 1); return vec; });
    for (auto& item : res) {
        std::cout << item << " ";
    }
    std::cout << std::endl;

    auto res1 = std::accumulate(numbers.cbegin(), numbers.cend(), 0, arg1 + arg2 * arg2);
    std::cout << res1 << std::endl;

    auto res2 = std::accumulate(numbers.cbegin(), numbers.cend(), 0, arg1 + arg2);
    std::cout << res2 << std::endl;

    My_Class my("wyk");
    std::function<std::string(My_Class)> f;
    f = std::mem_fn(&My_Class::get_me);
    std::cout << f(my) << std::endl;
    std::function<std::string(My_Class)> f1;
    f = std::mem_fn(&My_Class::me);
    std::cout << f(my) << std::endl;
    return 0;
}
